package com.zy.servlet.yhgl;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import com.zhang.sys.SysUser;
import com.zy.service.YhglService;


public class GetTotalRoles extends HttpServlet{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public void doGet(HttpServletRequest req , HttpServletResponse res) throws IOException
	{
		process(req,res);
	}
	public void doPost(HttpServletRequest req , HttpServletResponse res) throws IOException
	{
		process(req,res);
	}
	private void process(HttpServletRequest req , HttpServletResponse res) throws IOException
	{
		SysUser userBean = (SysUser)req.getSession().getAttribute("userBean");
		String username ="";
		if(userBean != null){
			username=userBean.getUserId();
		}
		res.setContentType("application/x-json;charset=utf-8");
		PrintWriter out =  res.getWriter();
		YhglService userService =new YhglService();
		JSONObject obj = JSONObject.fromObject(userService.getTotalRoles(username));
		out.println( obj );
		out.flush();
	}
}
